<?php

namespace App\Http\Services\FormBuilder\Elements;

class Text extends Input
{
    public $fillable = [
        'id', 'name','value','type', 'placeholder','class'
    ];

    public function placeholder($placeholder)
    {
        $this->setAttribute('placeholder', $placeholder);

        return $this;
    }

    public function defaultValue($value)
    {
        if (!$this->hasValue()) {
            $this->setValue($value);
        }

        return $this;
    }

    protected function hasValue()
    {
        return isset($this->attributes['value']);
    }

}
